from datetime import datetime
from pydantic import BaseModel
from database.user_db import enum


class RoleBase(BaseModel):
    name: str
    chinese_name: str


class RoleCreate(RoleBase):
    pass


class RoleDBInfo(RoleBase):
    id: int


class Role(RoleDBInfo):
    pass


class UserBase(BaseModel):
    username: str
    gender: enum.Gender | None = enum.Gender.unknown
    job_num: int | None = None


class UserCreate(UserBase):
    """
    创建用户模型：
    """
    password: str
    role_name: str


class User(UserBase):
    """可返回信息"""
    id: int
    add_time: datetime


class UserDBInfo(User):
    """
    用户数据库信息
    """
    password: str
    status: enum.Status
    role: RoleDBInfo
